import request from '@/utils/request.js'

export function getBook(id){
  return request({
    url: '/book-reader/book/' + id,
    method: 'get'
  })
}

export function getBookChapterDetail(id, chapterOrder) {
  return request({
    url: '/book-reader/book/' + id + '/chapter-order/' + chapterOrder,
    method: 'get'
  })
}

export function getBookChapterContent(bookId, id) {
  return request({
    url: '/book-reader/book/' + bookId + '/chapter/' + id,
    method: 'get'
  })
}

export function getBookChapterList(id, page, pageSize) {
  return request({
    url: '/book-reader/book/' + id + '/chapters',
    method: 'get',
    params: {
      page: page,
      pageSize: pageSize
    }
  })
}

export function getBookList(page, pageSize, name) {
  return request({
    url: '/book-reader/books',
    method: 'get',
    params: {
      page: page,
      pageSize: pageSize,
      name: name
    }
  })
}

export function makeAVow(bookName, author) {
  return request({
    url: '/book-reader/want/book',
    method: 'post',
    data: {
      bookName: bookName,
      author: author
    }
  })
}